<?php

namespace App\Admin\Exports;

use Encore\Admin\Grid\Exporters\ExcelExporter;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;

class PayOrderExport extends ExcelExporter implements WithMapping, WithHeadings, ShouldAutoSize
{
    //这里是导出来的文件的名字和格式
    protected $fileName = '订单表.xlsx';
    //这里是excel的标题
    public function headings(): array
    {
        return [
            '第三方订单',
            '订单金额'
        ];
    }

    public function map($data): array
    {
        return [
            $data->out_trade_no,
            $data->total_amount / 100,
        ];
    }
}
